// 用户相关类型
export interface User {
  id: number;
  username: string;
  email: string;
  role: 'user' | 'admin';
}

// Nginx配置相关类型
export interface NginxConfig {
  id: number;
  name: string;
  content: string;
  isActive: boolean;
  createdAt: string;
  updatedAt: string;
  file_path: string;
  servers: ServerConfig[];
  upstreams: UpstreamConfig[];
  nginxCwd: string;
  isDockerized: boolean;
  dockerHostPath?: string;
  dockerContainerPath?: string;
  dockerHostLogPath?: string;
  dockerContainerLogPath?: string;
}

export interface ServerConfig {
  server_name: string[];
  listen: number[];
  ssl: boolean;
  ssl_certificate?: string;
  ssl_certificate_key?: string;
  locations: LocationConfig[];
}

export interface LocationConfig {
  path: string;
  proxy_pass?: string;
  root?: string;
  index?: string[];
}

export interface UpstreamConfig {
  name: string;
  servers: UpstreamServer[];
}

export interface UpstreamServer {
  address: string;
  weight?: number;
  backup?: boolean;
  down?: boolean;
  max_fails?: number;
  fail_timeout?: string;
  comment?: string;
}

// SSL证书相关类型
export interface SSLCertificateStatus {
  id: number;
  name: string;
  expiry_date: string;
  days_remaining: number;
  is_expired: boolean;
}

// API响应类型
export interface ApiResponse<T> {
  data: T;
  message: string;
}

// API响应数据类型
export interface ApiData<T> {
  data: T;
}

// 登录相关类型
export interface LoginForm {
  username: string;
  password: string;
}

export interface RegisterForm {
  username: string;
  email: string;
  password: string;
}

export interface LoginResponse {
  token: string;
  user: User;
}

// 日志类型
export interface NginxLog {
  id: number;
  type: 'access' | 'error';
  content: string;
  timestamp: string;
  level?: 'info' | 'warn' | 'error';
  ip?: string;
  method?: string;
  path?: string;
  status?: number;
} 